import 'package:flutter/material.dart';
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:freedom/page/mahjong/provider/mahjong_room_info.dart';
import 'package:provider/provider.dart';

class AllUserAvWidget extends StatefulWidget {
  const AllUserAvWidget({super.key});

  @override
  State<AllUserAvWidget> createState() => _AllUserAvWidgetState();
}

class _AllUserAvWidgetState extends State<AllUserAvWidget> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width / 2,
      color: Colors.white10,
      child: Row(
        children: <Widget>[
          /*   Expanded(
            child: Container(
              margin: const EdgeInsets.fromLTRB(0, 0, 0, 0),
              decoration: const BoxDecoration(color: Colors.black54),
              child: RTCVideoView(MircoPhoneOpen.localRenderer),
            ),
          ), */
          Expanded(
            child: Container(
              margin: const EdgeInsets.fromLTRB(0, 0, 0, 0),
              decoration: const BoxDecoration(color: Colors.black54),
              child: Consumer<MahjongRoomInfoProvider>(
                  builder: (buildContext, provider, child) {
                return provider.userPeerConnection == null
                    ? const SizedBox()
                    : RTCVideoView(provider.userPeerConnection!.remoteRenderer);
              }),
            ),
          ),
        ],
      ),
    );
  }
}
